package com.yxw.yxnet_cd_center.customer_service.controller;

import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.helper.ResultHelper;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import com.yxw.yxnet_cd_center.customer_service.dto.WorkflowForUserQueryDTO;
import com.yxw.yxnet_cd_center.customer_service.dto.WorkflowQueryDTO;
import com.yxw.yxnet_cd_center.customer_service.service.WorkflowService;
import com.yxw.yxnet_cd_center.customer_service.vo.YxCsWorkflowForUserVo;
import com.yxw.yxnet_cd_center.customer_service.vo.YxCsWorkflowVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 工作流管理
 *
 * @author liuxin
 * @date 2023.09.14
 */
@RestController
@Api(value = "工作流管理", tags = "工作流管理")
@Slf4j
@RequestMapping("/Workflow")
public class WorkflowController {

    @Autowired
    private WorkflowService workflowService;

    @ApiOperation(value = "工作流管理-查询工作流转接记录查询")
    @PostMapping(value = "/getWorkflowList")
    public BaseResult<PageVO<YxCsWorkflowVo>> getWorkflowList(@RequestBody WorkflowQueryDTO dto) {
        PageVO<YxCsWorkflowVo> pageVo = workflowService.getWorkflowList(dto);
        return ResultHelper.fillWithSuccess(pageVo);
    }

    @ApiOperation(value = "工作流管理-工作流记录删除")
    @DeleteMapping(value = "/deleteWorkflowById")
    public BaseResult deleteWorkflowById(Long id) {
        workflowService.deleteWorkflowById(id);
        return BaseResult.doSuccess(null, "删除成功");
    }

    @ApiOperation(value = "工作流管理-人员分流规则查询")
    @PostMapping(value = "/getWorkflowListForUser")
    public BaseResult<PageVO<YxCsWorkflowForUserVo>> getWorkflowListForUser(@RequestBody WorkflowForUserQueryDTO dto) {
        PageVO<YxCsWorkflowForUserVo> pageVo = workflowService.getWorkflowListForUser(dto);
        return ResultHelper.fillWithSuccess(pageVo);
    }

}
